package com.ostrich.demobrvah.divider

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.ostrich.demobrvah.R

class DividerActivity : AppCompatActivity() {
    private lateinit var rv:RecyclerView
    private lateinit var myAdapter: MyAdapter
    private val list: MutableList<DataBean> = mutableListOf()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_divider)
        rv = findViewById(R.id.rv)
        list.add(DataBean(R.drawable.ic_launcher_background,"0"))
        list.add(DataBean(R.drawable.ic_launcher_background,"1"))
        list.add(DataBean(R.drawable.ic_launcher_background,"2"))
        list.add(DataBean(R.drawable.ic_launcher_background,"3"))
        list.add(DataBean(R.drawable.ic_launcher_background,"4"))
        list.add(DataBean(R.drawable.ic_launcher_background,"5"))
        list.add(DataBean(R.drawable.ic_launcher_background,"6"))
        list.add(DataBean(R.drawable.ic_launcher_background,"7"))
        list.add(DataBean(R.drawable.ic_launcher_background,"8"))
        list.add(DataBean(R.drawable.ic_launcher_background,"9"))
        list.add(DataBean(R.drawable.ic_launcher_background,"10"))
        list.add(DataBean(R.drawable.ic_launcher_background,"11"))
        myAdapter = MyAdapter(R.layout.item_divider_h,list)
        rv.adapter = myAdapter
        rv.layoutManager = GridLayoutManager(this,3,GridLayoutManager.HORIZONTAL,false)



        rv.addItemDecoration(CustomItemHorzitalDecoration(3,20))

    }
}